import { defineStore } from 'pinia'
import {nextTick} from "vue";

export const useSystemStore = defineStore('system', {
    state: () => {
        return {
            // 系统通知
            systemNotification: {},
            // 单前主对话页
            currentPage: 'chat'
        }
    },
    actions: {
        // 发送提问
        sendSystemNotification(message , type) {
            console.log(message)
            const typeInfo = this.getTypeInfo(type)
            const messageObj =   {
                    name: "提示",
                    description: message,
                    time: "刚刚",
                    icon: typeInfo.icon,
                    color: typeInfo.color,
                }

            this.systemNotification = messageObj

        },
        getTypeInfo(type) {
            switch (type) {
                case 'info' : return {
                    icon: '💸',
                    color:'#00C9A7'
                }
                case 'warning' : return {
                    icon: '💸',
                    color:'red'
                }
                default: return {
                    icon: "💸",
                    color: "#00C9A7",
                }
            }

        }
    },
})
